#include<bits/stdc++.h>
using namespace std;
int main(){
  freopen("road.in","r",stdin);
  freopen("road.out","w",stdout);
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0);
  int n; cin>>n;
  if(!n)cout<<"2 1\n1 114 0\n",exit(0);
  if(n==1)cout<<"2 2\n1 114 0\n1 114 1\n",exit(0);
  int l=__lg(n+1)-1;
  vector<tuple<int,int,int> > e;
  e.emplace_back(1,2,0);
  auto f=[&](int x){return x==l+3?114:x;};
  for(int i=1;i<=l+1;i++)
    e.emplace_back(i+1,f(i+2),0),
    e.emplace_back(i+1,f(i+2),1<<l-i+1);
  int x=n-(1<<l+1);
  while(x>=0){
    int l2=__lg(x+1)-1;
    e.emplace_back(1,f(l-l2+2),n-x);
    x-=1<<l2+1;
  }
  cout<<l+3<<' '<<e.size()<<endl;
  for(auto i:e)cout<<get<0>(i)<<' '<<get<1>(i)<<' '<<get<2>(i)<<'\n';
  return 0;
}